package com.huawei.appgallery.appcomment.ui;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.MenuItem;
import androidx.fragment.app.Fragment;
import com.huawei.appgallery.appcomment.api.CommentReplyActivityProtocol;
import com.huawei.appgallery.appcomment.api.CommentReplyActivityProtocol.Request;
import com.huawei.appgallery.foundation.ui.framework.activity.BaseActivity;
import com.huawei.fastengine.fastview.startFastappEngine.bean.RpkInfo;
import o.bcg.a;
import o.bcg.d;
import o.bcg.e;
import o.bcg.h;
import o.FragmentTransaction;

public class AppCommentReplyActivity extends BaseActivity<CommentReplyActivityProtocol> {
    private c ˊॱ;
    private b ˋॱ;

    public interface b {
        boolean ˎ();
    }

    public interface c {
        void ˊ();
    }

    public void ˏ(c cVar) {
        this.ˊॱ = cVar;
    }

    protected void onRestart() {
        if (this.ˊॱ != null) {
            this.ˊॱ.ˊ();
        }
        super.onRestart();
    }

    public void ˊ(b bVar) {
        this.ˋॱ = bVar;
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(d.ˏॱ);
        ॱ(getString(h.ˌॱ));
        getWindow().getDecorView().setBackgroundColor(getResources().getColor(a.ॱ));
        if (bundle == null) {
            String str = "";
            str = "";
            str = "";
            CommentReplyActivityProtocol commentReplyActivityProtocol = (CommentReplyActivityProtocol) ʾ();
            if (commentReplyActivityProtocol == null || commentReplyActivityProtocol.ˊ() == null) {
                finish();
                return;
            }
            Request ˊ = commentReplyActivityProtocol.ˊ();
            Object ˏ = ˊ.ˏ();
            String ˊ2 = ˊ.ˊ();
            Object ˋ = ˊ.ˋ();
            int ॱ = ˊ.ॱ();
            int ˎ = ˊ.ˎ();
            int ᐝ = ˊ.ᐝ();
            boolean ॱॱ = ˊ.ॱॱ();
            if (TextUtils.isEmpty(ˏ) || TextUtils.isEmpty(ˋ)) {
                finish();
                return;
            }
            Fragment appReplyFragment = new AppReplyFragment();
            Bundle bundle2 = new Bundle();
            bundle2.putString(RpkInfo.APPID, ˋ);
            bundle2.putString("commentid", ˏ);
            bundle2.putString("user_name", ˊ2);
            bundle2.putInt("is_approved", ॱ);
            bundle2.putInt("is_dissed", ˎ);
            bundle2.putInt("position", ᐝ);
            bundle2.putBoolean("show_all_comment", ॱॱ);
            appReplyFragment.ʼ(bundle2);
            FragmentTransaction ˊ3 = ˏॱ().ˊ();
            ˊ3.ˏ(e.ʽ, appReplyFragment, "AppDetailReply");
            ˊ3.ˋ();
        }
    }

    public void onDestroy() {
        super.onDestroy();
    }

    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i == 4 && keyEvent.getRepeatCount() == 0 && this.ˋॱ != null) {
            this.ˋॱ.ˎ();
        }
        return super.onKeyDown(i, keyEvent);
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (16908332 != menuItem.getItemId()) {
            return super.onOptionsItemSelected(menuItem);
        }
        finish();
        return true;
    }
}
